#include <stdio.h>
#include <string.h>

int main() {
    int n = 0;
    char buf[21];
    scanf("%d %s", &n, buf);
    const int k = strlen(buf);

    int res = 1;
    for (int i = n; i > 1; i -= k)
        res *= i;

    printf("%d\n", res);

    return 0;
}
